<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>菜鸟教程</title>
  <script type="text/javascript">
    { // null 
      console.log(null == null)
      console.log(null == undefined)
      console.log(null == false)
      console.log(null == '')
      console.log(null == 0)

      console.log(null === null)
      console.log(null === undefined)
      console.log(null === false)
      console.log(null === '')
      console.log(null === 0)
    }

    { // undefined
      console.log(undefined == undefined)
      console.log(undefined == null)
      console.log(undefined == false)
      console.log(undefined == '')
      console.log(undefined == 0)
    }

    { // 数字和字符串
      console.log(123 == '123')
      console.log(123 === '123')
    }

    { // 布尔类型
      // 首先 b 是 boolean 类型, 所以 ToNumber(b) 将 b 的类型强制转换为 1, 变成 1 == '77', 二者的类型仍然不同, "77" 根据规则被强制类型转换为 77, 最后变成 1 == 77, 所以结果输出为 false;
      console.log(true == '123', '!')
      console.log(true == '1', '!')
      console.log(true == 1, '!')


      console.log(true === '123')
      console.log(true === '1')
      console.log(true === 1)
    }

    {

      console.log(77 == [77], '??')
      console.log('abc' == Object('abc'))
      console.log()
      console.log()
      console.log()
      console.log()
      console.log()
      console.log()
      console.log()
    }

    { // ==中的隐式强制类型转换最为让人不满的地方是假值的相等比较下面分别列出了常规和非常规的情况:
      console.log("0" == null); // false
      console.log("0" == undefined); // false
      console.log("0" == false); // true
      console.log("0" == NaN); // false
      console.log("0" == 0); // true
      console.log("0" == ""); // false

      console.log(false == null); // false
      console.log(false == undefined); // false
      console.log(false == NaN); // false
      console.log(false == 0); // true
      console.log(false == ""); // true
      console.log(false == []); // true
      console.log(false == {}); // false

      console.log("" == null); // false
      console.log("" == undefined); // false
      console.log("" == NaN); // false
      console.log("" == 0); // true
      console.log("" == []); // true
      console.log("" == {}); // false

      console.log(0 == null); // false
      console.log(0 == undefined); // false
      console.log(0 == NaN); // false
      console.log(0 == []); // true
      console.log(0 == {}); // false

    }
  </script>
  <style type="text/css">

  </style>
</head>

<body>
  <div>

  </div>
</body>

</html>